package com.easymeeting.controller;

import java.util.List;

import com.easymeeting.entity.query.TbOrderQuery;
import com.easymeeting.entity.po.TbOrder;
import com.easymeeting.entity.vo.ResponseVO;
import com.easymeeting.service.TbOrderService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 *  Controller
 */
@RestController("tbOrderController")
@RequestMapping("/tbOrder")
public class TbOrderController extends ABaseController{

	@Resource
	private TbOrderService tbOrderService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(TbOrderQuery query){
		return getSuccessResponseVO(tbOrderService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(TbOrder bean) {
		tbOrderService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<TbOrder> listBean) {
		tbOrderService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<TbOrder> listBean) {
		tbOrderService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id查询对象
	 */
	@RequestMapping("/getTbOrderById")
	public ResponseVO getTbOrderById(Integer id) {
		return getSuccessResponseVO(tbOrderService.getTbOrderById(id));
	}

	/**
	 * 根据Id修改对象
	 */
	@RequestMapping("/updateTbOrderById")
	public ResponseVO updateTbOrderById(TbOrder bean,Integer id) {
		tbOrderService.updateTbOrderById(bean,id);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id删除
	 */
	@RequestMapping("/deleteTbOrderById")
	public ResponseVO deleteTbOrderById(Integer id) {
		tbOrderService.deleteTbOrderById(id);
		return getSuccessResponseVO(null);
	}
}